Skip to content

[tmpnet] Source tmpnet defaults from a configmap #4057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2025
Merged

Conversation

maru-ava
Copy link
Contributor

@maru-ava maru-ava commented Jul 8, 2025

Why this should be merged

Previously the scheduling label and value required to enable exclusive scheduling were defined as flag defaults. To enable the cluster to define these defaults, the defaults are now sourced from a configmap in the target namespace.

How this was tested

CI, manually

Need to be documented in RELEASES.md?

N/A

@maru-ava maru-ava self-assigned this Jul 8, 2025
@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 04:02
@maru-ava maru-ava added the tooling Build, test and development tooling label Jul 8, 2025
@maru-ava maru-ava moved this to Ready 🚦 in avalanchego Jul 8, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR centralizes tmpnet scheduling defaults in a Kubernetes ConfigMap rather than hardcoded flag defaults.

  • Updated EnsureDefaultConfig to accept a context.Context and delegate to Kube-specific defaulting
  • Added KubeRuntimeConfig.ensureDefaults to fetch scheduling labels from a tmpnet ConfigMap
  • Removed static flag defaults and manual validation for scheduling labels

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/fixture/tmpnet/network_test.go Updated test to pass ctx into EnsureDefaultConfig
tests/fixture/tmpnet/network.go Changed EnsureDefaultConfig signature and call sites to include ctx
tests/fixture/tmpnet/kube_runtime.go Added ensureDefaults method to source scheduling defaults from ConfigMap
tests/fixture/tmpnet/flags/kube_runtime.go Removed hardcoded flag defaults and validation for scheduling labels
Comments suppressed due to low confidence (4)

tests/fixture/tmpnet/kube_runtime.go:58

  • [nitpick] This error message references flag names, but it can also be triggered by missing keys in the ConfigMap. Consider clarifying that missing config-map entries will produce this error.
var errMissingSchedulingLabels = errors.New("--kube-scheduling-label-key and --kube-scheduling-label-value are required when exclusive scheduling is enabled")

tests/fixture/tmpnet/flags/kube_runtime.go:79

  • [nitpick] Since defaults now come from a ConfigMap, update the flag usage text to mention that no in-code default is set and that users should configure the tmpnet ConfigMap.
		"",

tests/fixture/tmpnet/kube_runtime.go:82

  • Add unit tests for ensureDefaults to verify behavior when the ConfigMap contains valid defaults and when keys are missing.
func (c *KubeRuntimeConfig) ensureDefaults(ctx context.Context, log logging.Logger) error {

tests/fixture/tmpnet/network_test.go:29

  • It looks like ctx isn’t defined in this test. Consider adding ctx := context.Background() and importing the context package at the top of the file.
	require.NoError(network.EnsureDefaultConfig(ctx, logging.NoLog{}))

@maru-ava
Copy link
Contributor Author

Rebased

Copy link
Contributor

@RodrigoVillar RodrigoVillar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maru-ava maru-ava added this pull request to the merge queue Jul 18, 2025
Merged via the queue into master with commit 9424a2a Jul 18, 2025
29 checks passed
@maru-ava maru-ava deleted the tmpnet-configmap branch July 18, 2025 15:15
@github-project-automation github-project-automation bot moved this from Ready 🚦 to Done 🎉 in avalanchego Jul 18, 2025
maru-ava added 4 commits July 21, 2025 02:54
Previously the scheduling label and value required to enable exclusive
scheduling were defined as flag defaults. To enable the cluster to
define these defaults, the defaults are now sourced from a configmap
in the target namespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Build, test and development tooling
Projects
Status: Done 🎉
Development

Successfully merging this pull request may close these issues.

3 participants